      SUBROUTINE TIPVEC(      ZLL,ZLD,ZLDD,A,B,AD,BD,ADD,BDD,
     *XSH,XSHP,XSHPP,ZNP,XAI,XAID,XAIDD)
C
      IMPLICIT REAL*8 (A-H,O-Z)
C
C   THIS SUBROUTINE IS TO COMPUTE THE BOOM TIP POSITION
C   VELOCITY AND ACCELERATION VECTORS IN THE BOOM ELEMENT
C   FRAME FOR THE USE OF SUBROUTINE ACCOMP
C
C   INPUT VARIABLES
C
C   ZLL,ZLD,ZLDD---- BOOM LENGTH, DEPLOYMENT RATE AND ACCELERATION
C   A,B------OUT AND IN-PLANE DEFLECTIONS, THE GENERALIZED COORDINATES
C   AD,BD---- OUT AND IN-PLANE VELOCITY
C   ADD,BDD,----OUT AND IN-PLANE ACCELERATIONS
C   XSH,XSHP,XSHPP----SHAPE FUNCTION OF THE ELEMENTAND ITS DERIVATIVES
C   ZNP------AXIAL DISPLACEMENT SHPAE FUNCTION
C
C   OUTPUT VARIABLES
C
C   XAI----POSITION VECTOR OF THE TIP IN ELEMENT FRAME
C   XAID----VELOCITY VECTOR OF TIP IN ELEMENT FRAME
C   XAIDD----ACCELERATION VECTOR OF TIP IN THE ELEMENT FRAME
C
      COMMON/DEBUG2/IOUT,JOUT,KLUGE
C
      DIMENSION A(3),B(3),AD(3),BD(3),ADD(3),BDD(3)
      DIMENSION XSH(3),XSHP(3),XSHPP(3),ZNP(3,3)
      DIMENSION XAI(3),XAID(3),XAIDD(3)
      DIMENSION DUM1(3),DUM2(3),DUM3(3),DUM4(3),DUM5(3),DUM6(3)
C
C   COMPUTE THE POSITION VECTOR
C
      DO 10 I=1,3
      DUM1(I)=0.0D0
      DUM2(I)=0.0D0
      DUM3(I)=0.0D0
      DUM4(I)=0.0D0
      DUM5(I)=0.0D0
      DUM6(I)=0.0D0
 10   CONTINUE
      DO 20 I=1,3
      DO 30 J=1,3
      DUM1(I)=DUM1(I)+ZNP(I,J)*A(J)
      DUM2(I)=DUM2(I)+ZNP(I,J)*B(J)
 30   CONTINUE
 20   CONTINUE
      DA=A(1)*DUM1(1)+A(2)*DUM1(2)+A(3)*DUM1(3)
      DB=B(1)*DUM2(1)+B(2)*DUM2(2)+B(3)*DUM2(3)
      U1=-(DA+DB)/(2.0D0*ZLL)
      U2=A(1)*XSH(1)+A(2)*XSH(2)+A(3)*XSH(3)
      U3=B(1)*XSH(1)+B(2)*XSH(2)+B(3)*XSH(3)
C
C   THE POSITION VECTOR
C
      XAI(1)=U1+ZLL
      XAI(2)=U2
      XAI(3)=U3
C
C   END OF POSITION VECTOR COMPUTATION
C
C   THE VELOCITY VECTOR COMPUTATION
C
      DO 40 I=1,3
      DO 50 J=1,3
      DUM3(I)=DUM3(I)+ZNP(I,J)*AD(J)
      DUM4(I)=DUM4(I)+ZNP(I,J)*BD(J)
 50   CONTINUE
 40   CONTINUE
      DA=AD(1)*DUM1(1)+AD(2)*DUM1(2)+AD(3)*DUM1(3)
      DB=BD(1)*DUM2(1)+BD(2)*DUM2(2)+BD(3)*DUM2(3)
      DC=A(1)*DUM3(1)+A(2)*DUM3(2)+A(3)*DUM3(3)
      DD=B(1)*DUM4(1)+B(2)*DUM4(2)+B(3)*DUM4(3)
      U1D=-(DA+DB+DC+DD)/(2.0D0*ZLL)
      U2D=AD(1)*XSH(1)+AD(2)*XSH(2)+AD(3)*XSH(3)
      U3D=BD(1)*XSH(1)+BD(2)*XSH(2)+BD(3)*XSH(3)
      U2P=A(1)*XSHP(1)+A(2)*XSHP(2)+A(3)*XSHP(3)
      U3P=B(1)*XSHP(1)+B(2)*XSHP(2)+B(3)*XSHP(3)
      U1P=1.0D0-0.5D0*(U2P*U2P+U3P*U3P)
C
C   VELOCITY VECTORS
C
      XAID(1)=U1D+ZLD*U1P
      XAID(2)=U2D+U2P*ZLD
      XAID(3)=U3D+ZLD*U3P
C
C   END THE VELOCITY VECTOR COMPUTATIONC
C
C   THE ACCELERATION VECTOR COMPUTATION
C
      DO 60 I=1,3
      DO 70 J=1,3
      DUM5(I)=DUM5(I)+ZNP(I,J)*ADD(J)
      DUM6(I)=DUM6(I)+ZNP(I,J)*BDD(J)
 70   CONTINUE
 60   CONTINUE
      DA=ADD(1)*DUM1(1)+ADD(2)*DUM1(2)+ADD(3)*DUM1(3)
      DB=BDD(1)*DUM2(1)+BDD(2)*DUM2(2)+BDD(3)*DUM2(3)
      DC=(AD(1)*DUM3(1)+AD(2)*DUM3(2)+AD(3)*DUM3(3))*2.0D0
      DD=(BD(1)*DUM4(1)+BD(2)*DUM4(2)+BD(3)*DUM4(3))*2.0D0
      DE=A(1)*DUM5(1)+A(2)*DUM5(2)+A(3)*DUM5(3)
      DF=B(1)*DUM6(1)+B(2)*DUM6(2)+B(3)*DUM6(3)
      U1DD=-(DA+DB+DC+DD+DE+DF)/(2.0D0*ZLL)
      U2DD=ADD(1)*XSH(1)+ADD(2)*XSH(2)+ADD(3)*XSH(3)
      U3DD=BDD(1)*XSH(1)+BDD(2)*XSH(2)+BDD(3)*XSH(3)
      U2PP=A(1)*XSHPP(1)+A(2)*XSHPP(2)+A(3)*XSHPP(3)
      U3PP=B(1)*XSHPP(1)+B(2)*XSHPP(2)+B(3)*XSHPP(3)
      U2PD=AD(1)*XSHP(1)+AD(2)*XSHP(2)+AD(3)*XSHP(3)
      U3PD=BD(1)*XSHP(1)+BD(2)*XSHP(2)+BD(3)*XSHP(3)
C
C   THE ACCELERATION VECTOR
C
      XAIDD(1)=U1DD+ZLDD*U1P-ZLD*ZLD*(U2PP+U3PP)
     *-2.0D0*(U2P*U2PD+U3P*U3PD)*ZLD
      XAIDD(2)=U2DD+ZLDD*U2P+ZLD*ZLD*U2PP+2.0D0*ZLD*U2PD
      XAIDD(3)=U3DD+ZLDD*U3P+ZLD*ZLD*U3PP+2.0D0*ZLD*U3PD
C
C   END OF ACCELERATION COMPUTATION
C
C   DEBUG MESSAGE IN TIPVEC
C
      IF(IOUT.EQ.1) GO TO 80
      WRITE(6,90)
 90   FORMAT('  DEBUG MESSAGE FROM SUBROUTINE TIPVEC')
      WRITE(6,100) ZLL,ZLD,ZLDD
 100  FORMAT('  ZLL, ZLD,ZLDD=',2X,3(F20.10,3X))
      WRITE(6,150) ADD(1),ADD(2),ADD(3)
 150  FORMAT(' ADD ARRAYD=',3(E20.10,3X))
      WRITE(6,160) BDD(1),BDD(2),BDD(3)
 160  FORMAT(' BDD ARRAYD=',3(E20.10,3X))
      WRITE(6,200) U1,U2,U3
 200  FORMAT(' U1, U2, U3 =',2X,3(E20.10,3X))
      WRITE(6,300) U1D,U2D,U3D
 300  FORMAT('  U1D, U2D, U3D=',2X,3(E20.10,3X))
      WRITE(6,400) U1P,U2P,U3P
 400  FORMAT(' U1P,U2P, U3P=',2X,3(E20.10,3X))
      WRITE(6,500) U1DD, U2DD, U3DD
 500  FORMAT(' U1DD, U2DD, U3DD=',2X,3(E20.10,3X))
      WRITE(6,600) U2PP,U3PP,U2PD,U3PD
 600  FORMAT(' U2PP,U3PP=',2(E20.10,2X),'U2PD,U3PD=',2(E20.10,2X))
      WRITE(6,700) XAI(1),XAI(2),XAI(3)
 700  FORMAT(' XAI VECTOR=',3(E20.10,2X))
      WRITE(6,800) XAID(1),XAID(2),XAID(3)
 800  FORMAT(' XAID VECTOR=',3(E20.10,2X))
      WRITE(6,900) XAIDD(1),XAIDD(2),XAIDD(3)
 900  FORMAT(' XAIDD VECTOR=',3(E20.10,2X))
C
 80   CONTINUE
C
      RETURN
      END
